clear all
set more off
set matsize 10000
tempfile ubigeo temp

local lista trust_police trust_army trust_church trust_newsp trust_rtv trust_parties trust_regi trust_jury trust_parliament trust_jne trust_onpe
local controls schooling male rural native married head 

use mergedp, clear

egen voted_bn = rowmax(voted_blank voted_null)
recode voted_bn voted_blank voted_null (. = 0) if voted == 0

** LABELS
label var todoA "Army"
label var todoT "Terrorist"

******* Results
drop if vote_matter == .
local lista part_party part_ronda part_water part_union part_milk part_neigh part_food part_mothe part_cultu part_sport

local r = 1
foreach var in `lista' {
	replace `var' = `var' * 100 
	reghdfe `var' todoA todoT `controls', abs(ubigeo1993 ubigeonac1993 i.ubigeo1993#i.ubigeonac1993 i.age i.year i.provid#c.trend) vce(cluster ubigeonac1993) keepsin
	est store reg`r'
	sum `var' if e(sample) == 1
	local y = r(mean)
	sum todoA if e(sample) == 1 & todoA
	local sda = r(mean)
	sum todoT if e(sample) == 1 & todoT
	local sdt = r(mean)
	local na`r' = (round((100*(_b[todoA]) * `sda') / `y', 0.01)) 
	local nt`r' = (round((100*(_b[todoT]) * `sdt') / `y', 0.01)) 
	local ++r
}

noisily estout reg* ///
using Table_9_0.tex, style(tex) c(b(fmt(2) star) se(par fmt(2))) ///
	label collabels(, none) eqlabels(none) mlabels(, none) varlabel(_cons " $ Control $ ") starlevel(* .1 ** .05 *** .01) ///
	keep(todoA todoT) ///
	order(todoA todoT) ///
	stats(r2 N N_clust, fmt(%9.2f %9.0g) labels(`"$ R ^{2}$"' "Observations" "Clusters")) replace 

texdoc init Table_9.tex, replace
tex \begin{table}[h]
tex \caption{Impact of armed conflict on participation on selected organizations}
tex \label{tab:table3_part}
tex \begin{center}
tex \resizebox{16cm}{!}{
tex \begin{tabular}{lcccccccccc} \hline \hline
tex \\
tex & Political & Ronda & Irrigation & Union & Glass & Neighbor & Food & Mothers & Cultural & Sports \\
tex & party & campesina & committee  &  & of milk or & associaton & association & association & association & association \\
tex &&&&&Null&&&&& \\
tex &(1) &(2) &(3) &(4) &(5) &(6) &(7) &(8) &(9) &(10) \\
tex \hline
tex \input{Table_9_0.tex}
tex &&&&&&&&& \\
tex \multicolumn{8}{l}{\textbf{Effect of 1 s.d. change in conflict measure as \% of mean of dependent variable:}} \\
tex Army & `na1' & `na2' & `na3' & `na4' & `na5' & `na6' & `na7' & `na8' & `na9' & `na10' \\
tex Terrorist & `nt1' & `nt2' & `nt3' & `nt4' & `nt5' & `nt6' & `nt7' & `nt8' & `nt9' & `nt10' \\
tex &&&&&&&&& \\
tex \hline
tex \multicolumn{11}{p{1.5\textwidth}}{\small \textbf{Notes:} ***, **, and * indicate statistical significance at the 1 percent, 5 percent and 10 percent level, respectively. Standard errors in parentheses, clustered at district of birth level. All models include fixed effects for district of birth, district of residence, the match of district of birth and residence, age, wave of the national household survey, and a province specific linear trend. In addition, all models control for gender, marital status, family size and indicator variables for head of household, urban residence and native language (proxy for indigenous population).The variables ``Army'' and ``Terrorist" represents the number of years of exposure to violence from either the government or from terrorist forces (the two potential \emph{perpetrators}) within the age interval 0 to 30 years old.}
tex \end{tabular}}
tex \end{center}
tex \end{table}	
